vue-authenticate
vue-authenticate copied to clipboard
Add typescript types
Add definition files for Typescript. Fixes #117.
HTTP request and response are typed to corresponding axios objects. Mainly because I don't have motivation to test other providers.
Suggestion - in index.d.ts
, add a constructor to the VueAuthenticate
class declaration so it can be instantiated with new
, as per the Vuex example in the README.
eg:
import {AxiosResponse, AxiosRequestConfig, AxiosInstance} from 'axios';
export declare class VueAuthenticate {
public constructor($http: AxiosInstance, overrideOptions: AuthenticateOptions);
// .. other method declarations
}
Also, withCredentials
seems to be a valid flag for AuthenticateOptions
and should be added.
export interface AuthenticateOptions {
withCredentials?: boolean;
}
Thanks. I added the missing definitions. In the meantime I stopped using this library because it's missing some features I needed and it turned out to be more effective to just write one myself. I'm happy to support with merging this though.
Hi @ilari-makimattila , thanks for this PR. Can you please tell me which features are the key ones and the reason why you stopped using VueAuthenticate
?
One thing bothers me here. You made typings for Axios only ($http: AxiosInstance
), but this library can use any request library (previously, Vue-resource
was default library). What happens when you pass Vue-resource
library to handle network requests?
I see that you don't have motivation to test other libraries, but i can't merge half-finished work into master.
We decided to go with a hosted solution instead of managing our own user database and it felt easiest to just write a vue plugin instead of looking for an existing solution.
These types would more or less force any typescript user to use axios. But to be honest I don't really know how to write the type declarations in a way that wouldn't force the you to do explicit casts for every return value.
Hi, what is the status of this? I see there has been no activity in a while and the contributor who started it has stopped using this library. Is is worth picking up or are there no plans to integrate types?
Cheers
Please see https://github.com/dgrubelic/vue-authenticate/pull/196